package ThreeSixZero;

import org.omg.PortableInterceptor.Interceptor;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author le
 */
public class Test02
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        // n 个宝库 5
        int n = in.nextInt();
        // 每次最多飞行的距离 也就是滑动窗口的大小 10
        int m = in.nextInt();
        // 热气球最多启动k次
        int k = in.nextInt();
        // 存储输入的宝藏
        int[][] treasure = new int[n][2];
        for (int i = 0;i < n;i++){
            treasure[i][0] = in.nextInt();
            treasure[i][1] = in.nextInt();
        }
        // 表示最远能达到的距离
        int maxLength = k*m;
        int first = treasure[0][1];
        int[] res = new int[n];
        int index = 0;
        for (int i = 0;i < n;i++){
            if (treasure[i][0] < maxLength){
                res[index] = treasure[i][1];
                index++;
            }
        }
        Arrays.sort(res);
        int sum = 0;
        for (int i = n-1;i >= n-k;i--){
            sum += res[i];
        }
        System.out.println(sum+first);
        in.close();
    }
}
